#!/bin/bash -e
function info() {
echo Usage: `basename $0` '[-s sample_name -t] r1 r2'
exit 2
}

while getopts  ":p:f:s:t:i:" opt; do
	case  $opt  in
		p) out_prefix=$OPTARG;;
		f) suffix=$OPTARG;;
        s) sample_name=$OPTARG;;
        t) run_continue_dir=$OPTARG;;
        i) interval=$OPTARG;;
		*) info;;
	esac
done
shift $(($OPTIND - 1))

if [ $# -lt 2 ]; then info; fi

. $var

mnt='mnt.sh $$ `basename $0 .sh`.`basename $(pwd)` &'
path_abs=path_abs.sh
makedir=makedir.sh
trim_galore_=trim_galore.sh
bismark_='bismark.sh -s$sample_name'
# sam2b=sam2b_samtools.sh
# filter_bam_gatk=filter_bams_gatk.sh
# filter_bam_gatk_suf=filter_gatk
# merge_bam=merge_bam.sh
# deldup=deldup.sh
# summ=summ.sh
# summ_gatk=summ_gatk.sh
# fastqc='fastqc.sh -t8 -s$sample_name'
# fqstat='fqstat.sh -t8 -s$sample_name'
# csv2xls=csv2xls.pl
# tab2xls=tab2xls.pl
# bk='bk.sh -tsnp/methylation'


r1=$(path_abs.sh $1)
r2=$(path_abs.sh $2)


if test -z "$run_continue_dir"; then
run_continue_dir=`$makedir -p$sample_name` && cd $run_continue_dir
else 
cd $run_continue_dir
fi


# $mnt $$ `basename $0 .sh`.`basename $(pwd)` &
$mnt


echo;echo $r1 $r2
# adapters_file=$tools_path/Trimmomatic-0.36/adapters/TruSeq3-PE.fa
# primary_bed=$data_path/intervals/1/primary.bed 
# capture_bed=$data_path/intervals/1/capture.bed
# ref_genome_size=ref_genome.size.txt

#----------------------------------------------------

$trim_galore_ $r1 $r2

$bismark_ *_val_1.fq *_val_2.fq